package com.lovo.Atm;

import javax.swing.*;

import com.lovo.Util;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Land extends JPanel implements ActionListener {
    private Home frame;
    private Icon btnImg = Util.iconImg("/images/buttonLand.jpg");
    private Icon backIm= Util.iconImg("/images/buttonOff.jpg");
    private JButton btnImages;
    private JButton backImg;

    public Land(Home frame) {
        this.frame = frame;
        this.setLayout(null);
        this.setOpaque(false);
        //登录按钮
        btnImages = new JButton(btnImg);
        btnImages.setBounds(300, 300, 140, 50);
        this.add(btnImages);
        btnImages.addActionListener(this);

        //退出程序按钮
        backImg = new JButton(backIm);
        backImg.setBounds(600, 300, 140, 50);
        this.add(backImg);
        backImg.addActionListener(this);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == btnImages) {
            frame.switchPanel("menu");
        }if (e.getSource() == backImg){
            System.exit(0);
        }
    }
}
